<?php
namespace Crawl\Controller;
use Common\Controller\AdminbaseController;
// +----------------------------------------------------------------------
// | Date:2018年1月23日
// +----------------------------------------------------------------------
// | Author: EK_熊<1439527494@qq.com>
// +----------------------------------------------------------------------
// | Description: 此文件作用于****
// +----------------------------------------------------------------------
class EmailTmpController extends AdminbaseController{
    
    protected $model;
    public function _initialize(){
        $this->model = M('CrawlEmailTmp');
        $this->redis_key = C('REDIS_PREFIX')."email_tmp";
        $this->assign('title','邮件管理') ;
        
    }
    
    
    public function index(){
        $this->display();
    }
    
    public function edit(){
        self::edit_redis($keyfield);
    }
    
    
    public function add(){
        if (IS_POST) {
            $redis = new Redis();
            $post = I('post');
            $post['update_time'] =CURRENT_TIME;
            $post['create_time'] =CURRENT_TIME;
             
            $exist = $this->model->where(["$field"=>$post["$field"]])->find();
            if ($exist) $this->error("该{$field_name}已经存在");
             
            $ret = $this->model->add($post);
            if (!$ret) $this->error('添加失败！');
             
            $ret_redis = $redis->lPush($this->redis_key,$post["$field"]);
             
            $this->success('添加成功！');
        }
        
        $this->display();        
    }
}